/**
  ******************************************************************************
  * @file    main.c 
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    18-April-2011
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************  
  */ 

/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
// libs from discovery board, changed by us
#include "usart.h"
#include "camera/dcmi_OV7670.h"
// our libraries
#include "zFiles/main.h"


// main related vars
u8 debugChar = 0x00;


/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{	
	// init all Zsystems
	startupSystems(); 

	while(1)
	{
		// debug output testing, on usart debug
		if(debugChar != 0)
		{
			switch(debugChar)
			{
				case 'g':
				testGPIO();
				break;
	
				case 'a':
				testADC();
				break;
	
				case 'p':
				testPWMOUT();
				break;
	
				case 'c':
				testCAM();
				break;

				case 't':
				testComm();
				break;
	
				default:
				printf("\r\n");
				printf("Stopping Debug, valid values: g,a,p,t,c \r\n");
				debugChar =0;
				break;
			}
					
	
		}

		// process state from state machine
		stateMachineLoop();	
	} 								

}




#ifdef  USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {

  }
}
#endif

/**
  * @}
  */ 

/**
  * @}
  */ 

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
